<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<link href="<c:url value='/css/default.css'/>" rel="stylesheet" type="text/css"/>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script src="scripts/jquery-1.8.3.js" ></script>
<script src= "scripts/jquery.validate.min.js"></script>
<script type="text/javascript" src="scripts/NumericOnly.js" ></script>
<fmt:setBundle basename="message" />
<c:set var="t" value="true" />
<title><fmt:message key="showfacility.title"/></title>

<script type="text/javascript">

 
  (function($,W,D)
{
    var JQUERY = {};

    JQUERY.UTIL =
    {
        setupFormValidation: function()
        {
                       
            //form validation rules
            $("#FacitliyForm").validate({
                rules: {
                    name: "required",
                    description :"required",
                    type: "required",
                    seatingCapacity:"required",
                    status:"required"
                   
                },
                messages: {
                	name: "Please enter your name",
                	description: "Please enter description",
                	type:"Please enter type",
                	seatingCapacity:"Please enter Seating Capacity",
                	status:"Please enter Status"
                },
                submitHandler: function(form) {
                    form.submit();
                }
            });
        }
    }

    //when the dom has loaded setup form validation rules document.createElement('script');
    //window.jQuery.fn.jquery------ $("#id").functionname(function(){........});
    $(D).ready(function($) {
        JQUERY.UTIL.setupFormValidation();
    });

})(jQuery, window, document);
</script>


</head>

<body>
<%@include file="Header.jsp" %>
<div id="wrapper">	
    <div id="page-wrapper">
		<div id="page">
				<%@include file="Menu.jsp" %>   
			<div id="content">
<form action="ProcessFacility" method=post id="FacitliyForm">
<h2><fmt:message key="label.facility.add"/></h2> 

<table class="table-form">
<tr>
<td><fmt:message key="label.facility.name"/>
</td>
<td>
<c:if test="${param['insert']==t}" >
<input type="text" name="name" value="${param['name']}" size=15 maxlength=20>
<input type="hidden" name="ins" value="true" />
</c:if>
<c:if test="${param['update']==t}" >
<input type="text" name="name" value="${param['name']}" size=15 maxlength=20 readonly="readonly">
<input type="hidden" name="ins" value="false" />
</c:if>
</td>
</tr>

<tr>
<td><fmt:message key="label.facility.description"/>
</td>
<td><input type="text"  name="description" value="${param['description']}" size=15 maxlength=255>
</td>
</tr>
<tr>
<td><fmt:message key="label.facility.type"/>
</td>
<td><select name="type">
<option  value="Auditorium"${ param['type'] == "Auditorium" ? 'selected="selected"' : '' }>Auditorium</option>
<option  value="Discussion"${ param['type'] == "Discussion" ? 'selected="selected"' : '' }>Discussion</option>
<option  value="ClassRoom"${ param['type'] == "ClassRoom" ? 'selected="selected"' : '' }>ClassRoom</option>
<option  value="MeetingRoom"${ param['type'] == "MeetingRoom"? 'selected="selected"' : '' }>MeetingRoom</option>
<option  value="MPH"${ param['type'] == "MPH"? 'selected="selected"' : '' }>MPH</option>
</select>
</td>
</tr>

<tr>
<td><fmt:message key="label.facility.seatingcapacity"/>
</td>
<td><input type="text" name="seatingCapacity" value="${param['seatingCapacity']}"  class="numeric_field" size=15 maxlength=20>
</td>
</tr>

<tr>
<td><fmt:message key="label.facility.status"/>
</td>
<td><select name="status">
<option value="0" ${ param['status'] == 0 ? 'selected="selected"' : '' }>Not available</option>
<option  value="1" ${ param['status'] == 1 ? 'selected="selected"' : '' }>Available</option>
</select>
</td>

</tr>
</table>


<input type="submit" value="Submit" class="button-style"> 
<input type="reset" value="Reset" class="button-style-cancel">
</form>
</div>

<%@include file="Footer.jsp" %>
	</div>
</div>
</div>


</body>
</html>